package com.digua.tank;

import java.awt.*;
import java.util.Random;

/**
 * @author wangdigua
 * @title 爆炸效果
 * @date 2020/11/7 8:59 下午
 * @since 1.0.0
 */
public class Explod {

    public static final int WIDTH = ResourceMgr.explodes[0].getWidth();
    public static final int HEIGHT = ResourceMgr.explodes[0].getHeight();
    private int x  , y ;
    private TankFrame tankFrame ;
    private int step = 0 ;
    private static Audio audio = new Audio("audio/explode.wav");

    public Explod(int x, int y,TankFrame tankFrame) {
        this.x = x;
        this.y = y;
        this.tankFrame = tankFrame;
        audio.player();
    }

    /**
     * @param g
     */
    public void paint(Graphics g) {
        g.drawImage(ResourceMgr.explodes[step++], x, y, null);
        if (step >= ResourceMgr.explodes.length) {
            step = 0;
            tankFrame.explods.remove(this);
        }
    }




}
